package com.zys.el.time.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zys.el.time.entity.AbsorbedDeal;
import com.zys.el.time.entity.Deal;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;


public interface AbsorbedDealMapper extends BaseMapper<AbsorbedDeal> {
    /**
     * 通过待办id查询
     *
     * @param userId 用户id
     * @param dealId 待办id
     * @return 专注对象列表
     */
    List<AbsorbedDeal> getListByDealId(@Param("userId") Long userId,
                                       @Param("dealId") Long dealId);

    /**
     * absorbed_deal右连接tb_deal
     *
     * @param userId    用户id
     * @param startDate 日期上区间
     * @param endDate   日期下区间
     * @return Deal列表
     */
    List<Deal> getListByAbDealRightJoinDeal(@Param("userId") Long userId,
                                            @Param("startDate") LocalDate startDate,
                                            @Param("endDate") LocalDate endDate);

    @Select("SELECT deal_id ,count(*) count FROM `absorbed_deal` GROUP BY deal_id;")
    List<Map> getGroupByDealIdCount();

    List<AbsorbedDeal> getAbDealByDealId(String dealId);

    List<AbsorbedDeal> getAbDealByUserId(String dealId);
}




